package org.icy.core.setup;

import java.util.ArrayList;

import org.icy.core.setup.verification.DatabaseVerification;
import org.icy.core.setup.verification.SettingFileVerification;
import org.icy.core.setup.verification.JVMVerification;
import org.icy.core.setup.verification.MailVerification;
import org.icy.core.setup.verification.MemoryVerification;
import org.icy.core.setup.verification.ServerVerification;

public class RequirementVerification {
	
	public final static long MOD_WEBSERVER = 0x1;
	public final static long MOD_JAVA = 0x10;
	public final static long MOD_DATABASE = 0x100;
	public final static long MOD_MEM_LIMIT = 0x1000;
	public final static long MOD_MAIL = 0x10000;
	public final static long MOD_CONFIG_FILE = 0x100000;
	public final static long MOD_ALL = 0x111111;

	public ArrayList<VerificationResult> checkRequirements(long mods) {
		ArrayList<VerificationResult> results = new ArrayList<VerificationResult>();
		if ((mods & MOD_WEBSERVER) != 0) {
			results.add(new ServerVerification().verify());
		}
		if ((mods & MOD_JAVA) != 0) {
			results.add(new JVMVerification().verify());
		}
		if ((mods & MOD_DATABASE) != 0) {
			results.add(new DatabaseVerification().verify());
		}
		if ((mods & MOD_MEM_LIMIT) != 0) {
			results.add(new MemoryVerification().verify());
		}
		if ((mods & MOD_MAIL) != 0) {
			results.add(new MailVerification().verify());
		}
		if ((mods & MOD_CONFIG_FILE) != 0) {
			results.add(new SettingFileVerification().verify());
		}
		return results;
	}
}
